package cn.edu.scau.cmi.mazhuanglong.client;

import java.util.Scanner;
import cn.edu.scau.cmi.mazhuanglong.abstractFactory.factory.*;
import cn.edu.scau.cmi.mazhuanglong.abstractFactory.domainAbstractClass.ConsumerElectronicsDevice;

public class AbstractFactoryClient {
	public static void main(String[] args) {
		System.out.println("Please select which brand you want to buy: Wens, Tianbang or Aonong???");
		Scanner scanner = new Scanner(System.in);
		String brandKind = scanner.next();
		AbstractFactory factory = null;
		switch (brandKind) {
		case "Wens":
			factory = new WensFactory();
			break;
		case "Tianbang":
			factory = new TianbangFactory();
			break;
		case "Aonong":
			factory = new AonongFactory();
			break;
		default:
			System.out.println("sorry, your input is not correct");

		}

//	（2）选择产品

		System.out.println("Please select which product you want to buy: pork, beef or chicken???");
//	Scanner scanner = new Scanner(System.in);  
		String productType = scanner.next();
		ConsumerElectronicsDevice electronics = null;
		switch (productType) {
		case "pork":
			electronics = factory.createPork();
			break;
		case "beef":
			electronics = factory.createBeef();
			break;
		case "chicken":
			electronics = factory.createChicken();
			break;
		default:
			System.out.println("sorry, your input is not correct");

		}
		if (electronics != null) {
			electronics.play();
		}
	}

}
